const router = require('koa-router')()

router.get('/songs', async (ctx, next) => {
    let result = await ctx.db.query('SELECT * FROM songs');
    console.log(result)
    ctx.body = result;
})
router.get('/search', async (ctx, next) => {
    let keyword = ctx.query.keyword;
    let result = await ctx.db.query(`SELECT * FROM songs WHERE name LIKE '%${keyword}%'`);
    console.log(result)
    ctx.body = result;
})
module.exports = router